import QtQuick 1.0

Rectangle {
  id: toolbar
  width: parent.width
  height: 64
  color: "#000000"

  signal click(int index)

  property bool refresh_rotating
  refresh_rotating: false

  BorderImage {
    id: home
    anchors.left: parent.left
    source: "qrc:tb_home.svg"
    width: 64
    height: 64
  }

  BorderImage {
    id: unread
    anchors.left: home.right
    source: "qrc:tb_unread.svg"
    width: 64
    height: 64
  }

  BorderImage {
    id: newmsg
    anchors.left: unread.right
    source: "qrc:tb_newmsg.svg"
    width: 64
    height: 64
  }

  BorderImage {
    id: refresh
    anchors.left: newmsg.right
    source: "qrc:tb_refresh.svg"
    width: 64
    height: 64

    NumberAnimation on rotation {
      from: 360; to: 0; running: toolbar.refresh_rotating == true; loops: Animation.Infinite; duration: 900
    }
  }

  BorderImage {
    id: quit 
    anchors.left: refresh.right
    source: "qrc:tb_quit.svg"
    width: 64
    height: 64
  }

  MouseArea {
    anchors.fill: toolbar
    onClicked: {
      var index = Math.floor(mouse.x / 64);
      // if (index == 3) toolbar.refresh_rotating = true;
      toolbar.click(index);
    }
  }

}
